package epsi.mobile.constants;

//Contain Constants of localization 
public class LocalisationConstants {
	
    // The minimum distance to change Updates in meters
    public static final long MIN_DISTANCE_CHANGE_FOR_UPDATES = 10; // 10 meters

    // The minimum time between updates in milliseconds
    public static final long MIN_TIME_BW_UPDATES = 1000 * 60 * 1; // 1 minute
    
    public static final long DISTANCE_FOR_NEARBY_STORES = 30000; // 30 kilometers
    
    // Calculate the distance between two point
    public static float distFrom (double currentLat, double currentLong, double pointLat, double pointLong ) 
    {
        double earthRadius = 3958.75;
        double dLat = Math.toRadians(pointLat-currentLat);
        double dLng = Math.toRadians(pointLong-currentLong);
        double a = Math.sin(dLat/2) * Math.sin(dLat/2) +
        Math.cos(Math.toRadians(currentLat)) * Math.cos(Math.toRadians(pointLat)) *
        Math.sin(dLng/2) * Math.sin(dLng/2);
        double c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1-a));
        double dist = earthRadius * c;

        int meterConversion = 1609;

        return new Float(dist * meterConversion).floatValue();
    }

}
